<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"></script>
</head>

<body>

  <div id="app">

    <custom-layout>
<!-- #head插槽的名字 -->
      <template #head>
        head message
      </template>

      <template #main>
        main message
      </template>


      <template #foot>
        foot message
      </template>

    </custom-layout>


  </div>

  <script type="text/template" id="temp">
    <div>
      <div>
          <slot name="head"></slot>
      </div>
      <hr>
     <div>
      <slot name="main"></slot>
     </div>
<hr>
     <div>
      <slot name="foot"></slot>
     </div>
      <slot>default message</slot>
      </div>
  </script>

  <script>

    Vue.component('custom-layout', {
      data() {
        return {
          msg: "a"
        }
      },
      template: `#temp`
    })

    var vm = new Vue({
      el: "#app",
      data: {
        msg: "b"
      }
    })

  </script>
</body>

</html>